package com.angel.entity;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/*上传表单*/
public class FormFile {
	private byte[] bytes;//文件字节数组
	private String fileName;//文件名
	private InputStream inStream;//文件输入流
	/*默认文件类型*/
	private String contentType="application/octet-stream";
	private File file;//上传文件
	private String paramName;//请求参数名称
	public FormFile(String fileName,File file,String contentType,String paramName){
		this.fileName=fileName;
		this.paramName=paramName;
		this.file=file; 
		try {
			this.inStream=new FileInputStream(file);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		if(contentType!=null){
			this.contentType=contentType;
		}
	}
	public FormFile(String fileName,byte[] bytes,String contentType,String paramName){
		this.fileName=fileName;
		this.paramName=paramName;
		this.bytes=bytes;
		if(contentType!=null){
			this.contentType=contentType;
		}
	}
	public byte[] getBytes() {
		return bytes;
	}
	public void setBytes(byte[] bytes) {
		this.bytes = bytes;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public InputStream getInStream() {
		return inStream;
	}
	public void setInStream(InputStream inStream) {
		this.inStream = inStream;
	}
	public String getContentType() {
		return contentType;
	}
	public void setContentType(String contentType) {
		this.contentType = contentType;
	}
	public File getFile() {
		return file;
	}
	public void setFile(File file) {
		this.file = file;
	}
	public String getParamName() {
		return paramName;
	}
	public void setParamName(String paramName) {
		this.paramName = paramName;
	}

}
